<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button class="btn"></button>
    <input type="text">
      <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
      <script>
      let text = document.querySelector('input')
        document.querySelector('.btn').addEventListener('click',()=>{
            
            axios({
                url:'http://hmajax.itheima.net/api/city',
                params:{
                    pname:text.value,
                    
                }
            }).then(e=>{
                console.log(e.data);
                
            })
        })
      </script>
</body>
</html>